export default {
  // 开启命名空间
  namespaced: true,
  state: {
    count: 0,
  },
  getters: {
    oddOrEven(state) {
      return state.count % 2 === 1 ? "奇数" : "偶数";
    },
  },
  actions: {
    increment({ commit }, val) {
      commit("INCREMENT", val);
    },
  },
  mutations: {
    INCREMENT(state, val) {
      state.count += val;
    },
    DECREMENT(state, val) {
      state.count -= val;
    },
  },
};
